/////////////////////////////////////////////////////////////////////////
//                                                                     //
//   Orion/Z (Orion-128 + Z80-CARD-II) emulator, version 1.04          //
//                                                                     //
//   Addon: TotalCommander archiver (WCX) plugin for serving ODI files //
//          (Orion Disk Image files). Allow copy/extract CP/M files    //
//          to/from ODI file "diskette" such simple as processing any  //
//          archives in TotalCommander interface. Version 0.999alpha   //
//                                                                     //
//   How to install this plugin (32 bit only) in TotalCommander:       //
//          1. Unzip odi.wcx, system.bin to any directory              //
//                (usually c:\wincmd\Plugins)                          //
//          2. In Windows Commander 5.5 (or newer), choose             //
//                Configuration - Options                              //
//          3. Open the 'Packer' page                                  //
//          4. Click 'Configure packer extension DLLs'                 //
//          5. type the "ODI" extension                                //
//          6. Click 'new type', and select the  odi.wcx               //
//          7. Click OK.  Click OK                                     //
//          8. Repeat steps 2-7 for other supported (specified in      //
//               ODI.INI) formats - such as TRD, DSK, etc.             //
//                                                                     //
//   How to install this plugin (32 bit only) in Far Manager:          //
//          0. Install wcx.dll (plugin allowing TC WCX-plugins usage   //
//             in Far) to                                              //
//                   {FAR_DIR}\Plugins\Multiarc\Formats\WCX\           //
//             Install wcx.fmt to                                      //
//                   {FAR_DIR}\Plugins\Multiarc\Formats\               //
//          1. Unzip odi.wcx, system.bin to                            //
//                   {FAR_DIR}\Plugins\Multiarc\Formats\WCX\           //
//          1.2. To Support any other CP/M format (specified in INI),  //
//               just copy ODI.WCX, ODI.INI to files with              //
//               file name correcponding to format extension (for      //
//               example:  DSK.WCX, DSK.INI ;  TRD.WCX, TRD.INI) to    //
//                   {FAR_DIR}\Plugins\Multiarc\Formats\WCX\           //
//          2. Restart Far                                             //
//                                                                     //
//                                                                     //
//   Installation process for ohi.wcx (HDD images plugin) is the same  //
//          (except replacing 'ODI' -> 'OHI')                          //
//                                                                     //
//                                                                     //
//   Author: Sergey A.        <a-s-m@km.ru>                            //
//                                                                     //
//   Copyright (C)2009 Sergey A.                                       //
//                                                                     //
//   This program is free software; you can redistribute it and/or     //
//                  modify it in any ways.                             //
//   This program is distributed "AS IS" in the hope that it will be   //
//   useful, but WITHOUT ANY WARRANTY; without even the implied        //
//   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  //
//                                                                     //
/////////////////////////////////////////////////////////////////////////


     FILE2ODI, ODI_FORM, ODI_GRAB 
         CP/M 80.
        (    user 0), 
  ,   CP/M-   -
"  ",  c Total Commander    Far Manager :
  ODI-       (USER0..USER15). 
          
.     system.bin.

  1.01    ,    
  ohi.wcx - "wrapper"-      CP/M  
    (Orion Hdd Image = OHI).
                                                  
  1.0      "" (User-).
User-       ( : 
 "USER_0","USER_1",...),  User-     (
: "user_0","user_1",...).

  0.999  system.bin        ,
  odi.wcx,       AutoSysGen   INI.
      AutoSysGen  INI     ,
         - 
  INI  [FORMATS]  DPB (Disk Parameters Block) 
    .   "" (.. )  
   CP/M- ( ). ,  OD2
(Orion-HighDensity,     ACPM 2.x  AltairDos/BestDos)
   ,   800.   , >80, 
 -      .
 
  0.99    ( )   BOOT-
 - system.bin,     ODI-,
     ..

       (  0.99 ,   0.999 - 
  INI )      / - 
 .

         CP/M 2.2:

  -  acpm1-53.bin  Advanced CP/M  SP-Computer Club 1992.  - CP/M 2.2
                     ,       
                     -   

  -  Bestdos2.bin    AltairDOS 3.3  -    
                    1996.   AltairDOS 1.0 (c   BIOS).
                     CP/M 2.2,   :
                   + HD floppy ( 1700  ),   5121,
                        , ,
                      ,   (
                        ),    
                      ,    (+), 
                        ,   (*.bat) 
                     submit.com

  -  system.bin    AltairDOS 3.4h (AltairDOS   HDD)  
                      (Floopy Boot)

  -  system.hdd    AltairDOS 3.4h (AltairDOS   HDD)  
                       (IDE HDD Boot),  
                   OHI.WCX    (  ).
  :
                  AltairDOS 3.x    user0  
                     drivr.sys.

         H     system.bin    ,
    odi.wcx (  0.99)      INI.
           Bestdos2.bin (  AltairDOS 3.x)  
          (CP/M <-> MS-Dos).
   
          ,  ,    
  (DPB),     ( CP/M , ,
  ).         .
   DPB  (      CP/M , ,
  Robotron-1715, MSX, Spectrum)   INI   [PARAMS]  USE_DPBLESS_DISKS=1,
          DPB (DiskParamBlock),
     [FORMATS].        odi.ini 
       INI   [PARAMS]   FORMATS_LIST.

       ,      
   ,    ,     Alt+F5 (Files->Pack)
     (    )   "Configure"

       !
       !


  OHI.WCX  FAR Manager:
-------------------------------------

      .  :
   1. Far   .    OdiWcx.zip 
       odi.ini, odi.wcx, ohi.ini, ohi.wcx   
      {Far_dir}\Plugins\MultiArc\Formats\WCX\
   2.    {Far_dir}\Plugins\MultiArc\Formats\WCX\ 
        odi.ini, odi.wcx     , 
        odi_tmp.ini, odi_tmp.wcx
   3.  ohi.ini   :

[COMMON]
LibList=odi_tmp.wcx
DefaultFSsize=67108864
OScode=system.hdd

.   FAR  .

    :     ,  ohi.wcx
     (    ),
      CP/M     odi.wcx,
   dll.     dll (, 
         ), 
        .  ,   
 dll ""  ,     .

Far      dll,  .. odi.wcx,     
     . ,    dll  FAR  
 TC  -. -, - ...

        ,     
   *.OHI, FAR  TC  .  ,  
  ,     .

 "DefaultFSsize" -      .  
 ()      4Gb,    MBR c 
 BootLoader (  ,       
     )       
    32Mb,     ,   
  "OScode".    - ,  CP/M    
       fdisk.com.

 TC  - (    )   alt+F5 
           
     alt+F5   "Configure".    Far -  .




 ODI.INI:

*****
* ODI (Orion Disk Image, CP/M) - image size strictly (!) 819200 bytes:
*   5 x 1024b sectors, double density, 80 tracks, 4k catalog, 4 system tracks, 16k extents
**
* ODI_5x1024x2x80= 01010301050050002800040F0084017F00C00020000400
*      0101
* len: $03;    //   0=128, 1=256, 2=512, 3=1024  - orion(korvet) feature - must be defined!
* den: $01;    //  (  ?):  0=,  1=  - orion(korvet) feature - must be defined!
* sec: $0005;  // phisical sectors per track                  - this and items below are standard CPM features
* trk: $0050;  // phisical tracks on disk (one side)
* spt: $0028;  // logical sectors (128b) per track
* bsh: $04;    // Block Shift - Block Size is given by 128 * 2^(BSH).  Here BlockSize=2048
* blm: $0F;    // Block Mask - Block Size is given by 128 * (BLM +1).  Here BlockSize=2048
* exm: $00;    // Extent Mask (0=16k, 1=32k, 3=64k, 7=128k)
* dsm: $0184;  // user space size in 2048b blocks = SEC * (TRK-OFF) - (CKS/8)
* drm: $007F;  // max quantity of file records (FCBs) in catalog -1
* al:  $00C0;  // 16-bit Directory Allocation Pattern
* cks: $0020;  // Directory Check Sum = catalog size (in logical blocks)
* off: $0004;  // system tracks 
*
*****
* OD2 (Orion Disk Image, HighDensity, ACPM 2.x  Altair-DOS) - image size 1740800 bytes:
*  10 x 1024b sectors, double density, 85 tracks, 8k catalog, 2 system tracks, 16k extents
**
* OD2_10x1024x2x80= 010103010A0055005000040F004403FF00F00040000200
*      0101
* len: $03;    //   0=128, 1=256, 2=512, 3=1024  - orion(korvet) feature - must be defined!
* den: $01;    //  (  ?):  0=,  1=  - orion(korvet) feature - must be defined!
* sec: $000A;  // phisical sectors per track                  - this and items below are standard CPM features
* trk: $0055;  // phisical tracks on disk (one side)
* spt: $0050;  // logical sectors (128b) per track
* bsh: $04;    // Block Shift - Block Size is given by 128 * 2^(BSH).  Here BlockSize=2048
* blm: $0F;    // Block Mask - Block Size is given by 128 * (BLM +1).  Here BlockSize=2048
* exm: $00;    // Extent Mask (0=16k, 1=32k, 3=64k, 7=128k)
* dsm: $0344;  // user space size in 2048b blocks = SEC * (TRK-OFF) - (CKS/8)
* drm: $00FF;  // max quantity of file records (FCBs) in catalog -1
* al:  $00F0;  // 16-bit Directory Allocation Pattern
* cks: $0040;  // Directory Check Sum = catalog size (in logical blocks)
* off: $0002;  // system tracks 
*
*****
* PRO (Profi Disk Image, CP/M) - image size strictly (!) 819200 bytes:
*   5 x 1024b sectors, double density, 80 tracks, 4k catalog, 0 system tracks, 16k extents
**
* PROFI_5x1024x2x80= 01010301050050002800040F008E017F00C00020000000
*      0101
* len: $03;    //   0=128, 1=256, 2=512, 3=1024  - orion(korvet) feature - must be defined!
* den: $01;    //  (  ?):  0=,  1=  - orion(korvet) feature - must be defined!
* sec: $0005;  // phisical sectors per track                  - this and items below are standard CPM features
* trk: $0050;  // phisical tracks on disk (one side)
* spt: $0028;  // logical sectors (128b) per track
* bsh: $04;    // Block Shift - Block Size is given by 128 * 2^(BSH).  Here BlockSize=2048
* blm: $0F;    // Block Mask - Block Size is given by 128 * (BLM +1).  Here BlockSize=2048
* exm: $00;    // Extent Mask (0=16k, 1=32k, 3=64k, 7=128k)
* dsm: $018E;  // user space size in 2048b blocks = SEC * (TRK-OFF) - (CKS/8)
* drm: $007F;  // max quantity of file records (FCBs) in catalog -1
* al:  $00C0;  // 16-bit Directory Allocation Pattern
* cks: $0020;  // Directory Check Sum = catalog size (in logical blocks)
* off: $0000;  // system tracks 
*
*****
* TRD (Spectrum Disk Image)          - image size strictly (!) 655360 bytes:
*   16 x 256b sectors, double density, 80 tracks, 4k catalog, 2 system tracks, 16k extents
**
* TRD_16x256x2x80=    01010101100050002000040F003A017F00C00020000200
*      $0101
* len: $01;    //   0=128, 1=256, 2=512, 3=1024  - orion(korvet) feature - must be defined!
* den: $01;    //  (  ?):  0=,  1=  - orion(korvet) feature - must be defined!
* sec: $0010;  // phisical sectors per track                  - this and items below are standard CPM features
* trk: $0050;  // phisical tracks on disk (one side)
* spt: $0020;  // logical sectors (128b) per track
* bsh: $04;    // Block Shift - Block Size is given by 128 * 2^(BSH).  Here BlockSize=2048
* blm: $0F;    // Block Mask - Block Size is given by 128 * (BLM +1).  Here BlockSize=2048
* exm: $00;    // Extent Mask (0=16k, 1=32k, 3=64k, 7=128k)
* dsm: $013A;  // user space size in 2048b blocks = SEC * (TRK-OFF) - (CKS/8)
* drm: $007F;  // max quantity of file records (FCBs) in catalog -1
* al:  $00C0;  // 16-bit Directory Allocation Pattern
* cks: $0020;  // Directory Check Sum = catalog size (in logical blocks)
* off: $0002;  // system tracks 
*  
*****
* DSK (MSX CP/M Plus Disk Image)     - image size strictly (!) 368640 bytes:
*   9 x 512b sectors, single density, 80 tracks, 4k catalog, 2 system tracks, 32k extents
**
* DSK_9x512x1x80=   01010200090050002400040F01AD007F00C00020000200
* ,   240,    
*      $0101
* len: $02;    //   0=128, 1=256, 2=512, 3=1024  - orion(korvet) feature - must be defined!
* den: $00;    //  (  ?):  0=,  1=  - orion(korvet) feature - must be defined!
* sec: $0009;  // phisical sectors per track                  - this and items below are standard CPM features
* trk: $0050;  // phisical tracks on disk (one side)
* spt: $0024;  // logical sectors (128b) per track
* bsh: $04;    // Block Shift - Block Size is given by 128 * 2^(BSH).  BlockSize=2048
* blm: $0F;    // Block Mask - Block Size is given by 128 * (BLM +1).  BlockSize=2048
* exm: $01;    // Extent Mask (0=16k, 1=32k, 3=64k, 7=128k)
* dsm: $00AD;  // user space size in 2048b blocks = SEC * (TRK-OFF) - (CKS/8)
* drm: $007F;  // max quantity of file records (FCBs) in catalog -1
* al:  $00C0;  // 16-bit Directory Allocation Pattern
* cks: $0020;  // Directory Check Sum = catalog size (in logical blocks)
* off: $0002;  // system tracks 
*  
*
* : < >=<DiskParamBlock>[,<OS image file for sysgen>]
*
[PARAMS]
USE_DPBLESS_DISKS=1
FORMATS_LIST=ODI, OD2, TRD, DSK, PRO

[FORMATS]
ODI = 01010301050050002800040F0084017F00C00020000400 , system.bin
OD2 = 010103010A0055005000040F004403FF00F00040000200
TRD = 01010101100050002000040F003A017F00C00020000200 
DSK = 01010200090050002400040F01AD007F00C00020000200 
PRO = 01010301050050002800040F008E017F00C00020000000
